package com.yan.demo.arrydemo;

import java.util.Scanner;

public class ArrayDemo3 {
    public static void main(String[] args) {
        int[] arr = new int[10];
        double sum = 0;
        for (int i = 0; i < arr.length; i++) {
            arr[i] = new Scanner(System.in).nextInt();
        }
        for (int i = 0; i < arr.length; i++) {
            sum = sum + arr[i];
        }
        double avg = sum / arr.length;
        System.out.println("avg = " + avg);
        System.out.println("sum = " + sum);
        int count = 0;
        for (int i = 1; i < arr.length; i += 2) {
            sum = arr[i];
            count++;
        }
        avg = sum / count;
        System.out.println("sum = " + sum);
        System.out.println("avg = " + avg);
    }
}
